#include <stdio.h>
#include <stdlib.h>

#include "array_lib.h"

/*
 *Description: Initialize the linear table.
 *Params:
 *       L: Linear table will be initialized.
 *       size: Length of linear table will be initialized.
 * */
void InitList(unsigned char **L, int size)
{
    *L = (unsigned char *)calloc(size, 1);
}

/*
 *Description: Determine whether the linear table is empty.
 *Params:
 *       L: Linear table will be determined.
 *       ret: Determined result.
 * */
int ListIsEmpty(unsigned char *L)
{
    int ret = 0;

    if (L != NULL) {
        ret = 1;
    }

    return ret;
}

/*
 *Description:
 *Params:
 *       L: Linear table will be clear.
 *       ret: success: 0; failure = -1
 *
 * */
int ClearList(unsigned char *L)
{
    int ret = 0;

    if (L != NULL) {
        free(L);
    } else {
        ret = -1;
    }

    return ret;
}

/*
 *Description: Get the i-th element.
 *Params:
 *       L: Linear table.
 *       size: 
 *       e: 
 * */
int GetElem(unsigned char *L, int index, unsigned char *e)
{
    return 0;
}

/*
 *Decription: Find the element equal to given value and return
 *            its position int the table.
 *            L: Linear table.
 *            e: The given value.
 * */
int LocateElem(unsigned char *L, unsigned char e)
{
    return 0;
}

/*
 * Description: Insert the element at the i-th position
 *             in the linear table.
 *             L: Linear table.
 *             i: Positon.
 *             e: Element.
 * */
int ListIsert(unsigned char *L, int i, unsigned char e)
{

}

/*
 *Description: 
 *
 *
 *
 *
 * */
int ListDelete(unsigned char *L, int i, unsigned char e)
{

}

/*
 *
 *
 *
 * */
int ListLength(unsigned char L)
{
    int length;

    
    return length;
}
